import request from './request'

// 获取聊天历史列表
export function getChatHistoryList(params) {
  return request({
    url: '/api/chat-history',
    method: 'get',
    params
  })
}

// 获取聊天历史详情
export function getChatHistoryDetail(id) {
  return request({
    url: `/api/chat-history/${id}`,
    method: 'get'
  })
}

// 删除聊天历史
export function deleteChatHistory(id) {
  return request({
    url: `/api/chat-history/${id}`,
    method: 'delete'
  })
}

// 批量删除聊天历史
export function batchDeleteChatHistory(ids) {
  return request({
    url: '/api/chat-history/batch-delete',
    method: 'post',
    data: { ids }
  })
}

// 获取聊天历史统计数据
export function getChatHistoryStatistics() {
  return request({
    url: '/api/chat-history/statistics',
    method: 'get'
  })
}

// 获取聊天消息列表
export function getChatMessages(sessionId, params) {
  return request({
    url: `/api/chat-history/${sessionId}/messages`,
    method: 'get',
    params
  })
}

// 删除聊天消息
export function deleteChatMessage(sessionId, messageId) {
  return request({
    url: `/api/chat-history/${sessionId}/messages/${messageId}`,
    method: 'delete'
  })
}

// 获取用户聊天历史
export function getUserChatHistory(userId, params) {
  return request({
    url: `/api/chat-history/user/${userId}`,
    method: 'get',
    params
  })
}

// 获取热门问题
export function getHotQuestions(params) {
  return request({
    url: '/api/chat-history/hot-questions',
    method: 'get',
    params
  })
}